package flexo.examples;

import flexo.math.*;

public class Test_Graphic_LoadObj extends Test_Graphic_Base
{
	flexo.math.Quaternion rotation;
	flexo.math.Vector elapPos;
	flexo.scene.Node root;
	
	public static void main(String[] args)
	{
		run("flexo.examples.Test_Graphic_LoadObj");
	}
	
	public void init()
	{
		super.init();
		
		root = mainScene.addChild("root");
		
		rotation = Quaternion.createRotationY(0.1f);
		elapPos = new Vector(0,0.00001f,0);
		
		file.addPath("media");
		flexo.graphic.Material mat = graphic.addMaterial("default", "default");
		flexo.graphic.ShaderParam pTex = mat.getShaderParam("tex");
		pTex.setValue("textures/sec_cam_001_tex.jpg");		

		flexo.graphic.entity.Entity obj = graphic.addMesh("models/security_cam_001.obj");
		obj.setMaterial("default");
		root.setPosition(new Vector(0,0,0));
		root.setScale(7);
		obj.attachTo(root);		
	}

	public void cleanUp()
	{
	}	

	public void update()
	{
		rotation.fromAxis(new flexo.math.Vector(0,1,0), getElapsedTime() * 20);
		root.rotate(rotation);
	}
}
